/**
 * 简单封装 axios
 */

import axios from 'axios'

const request = axios.create({
  baseURL: 'http://192.168.1.102:8080', // 请求的接口地址，就是前端代码跑起来的地址，这样去请求不会跨域，到时候 vue.config.js 里转发就行
  timeout: 5000
})


request.interceptors.request.use((config) => {
  config.headers['Authorization'] = 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZGVudGl0eV90eXBlIjoiMjAwIiwiaWRlbnRpZmllciI6IjExMzI5MjkwOTFAcXEuY29tIiwiaWF0IjoxNjY0MjkxMzIwfQ.HuIZza9tupf-iGoV-59apZk5jEvgSzqOMjPSQ9Lmq2E'
  return config
}, (err) => {
  return Promise.reject(err)
})

request.interceptors.response.use((res) => {
  return res
}, (err) => {
  return Promise.reject(err)
})

export default request